package response

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

// 统一响应结构（包含中英文消息）
type APIResponse struct {
	Code      int         `json:"code"`
	Message   string      `json:"message"`
	MessageCN string      `json:"message_cn"`
	Data      interface{} `json:"data,omitempty"`
}

func OK(c *gin.Context, data interface{}, msg, msgCN string) {
	c.JSON(http.StatusOK, APIResponse{Code: 0, Message: msg, MessageCN: msgCN, Data: data})
}

func Error(c *gin.Context, httpCode int, code int, msg, msgCN string) {
	c.JSON(httpCode, APIResponse{Code: code, Message: msg, MessageCN: msgCN})
}
